package org.jeecg.modules.system.enums;

import lombok.Getter;

/**
 * @author yaojia
 * @since 2024-07-26 15:08
 * 机构类别
 **/
@Getter
public enum OrgCategoryEnum {

    COMPANY(1, "分、子公司"),
    DEPARTMENT(2, "内设机构"),
    JOB_POSITION(3, "岗位"),
    ;

    private final int code;
    private final String desc;

    OrgCategoryEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCategory() {
        return getCode() + "";
    }

    /**
     * 根据code获取组织类型
     *
     * @param code
     * @return
     */
    public static String getTemplatePathByConfig(int code) {
        return getEnumByCode(code).getDesc();
    }


    public static OrgCategoryEnum getEnumByCode(int code) {
        for (OrgCategoryEnum e : OrgCategoryEnum.values()) {
            if (e.code == code) {
                return e;
            }
        }
        return null;
    }

}
